class PropertyValue < ActiveRecord::Base
  set_table_name :product_property_values

  belongs_to :property_attribute, :touch => true
  belongs_to :metric

  #has_one :explanation_note, :dependent => :destroy, :as => :explanation
  
  delegate :value, :presentation, :to => :metric, :prefix => true

  def display_property_value
    "#{self.value} #{self.metric_value.blank? ? '' : "{" + self.metric_value + '}'}"
  end

  alias new_metric metric
  def metric
    new_metric || build_metric
  end
end
